import { of, Observable } from 'rxjs';
import { tap, concatAll, map } from 'rxjs/operators'

of(5000, 3000, 1000).pipe(
  tap(
    {
      next: (value) => { console.log("[1]next");console.log(value); },
      error:(error: any) => { console.log(error); },
      complete: () => { console.log("[1]complete"); }
    }
  ),
  map((value: number) => {
    return Observable.create((observer: any) => {
      setTimeout(() => {
        observer.next(`Timeout:${value}`);
        observer.complete();
      }, value);
    });
  }),
  tap(
    {
      next: (value) => { console.log("[2]next");console.log(value); },
      error:(error: any) => { console.log(error); },
      complete: () => { console.log("[2]complete"); }
    }
  ),
  concatAll(),
  tap(
    {
      next: (value) => { console.log("[3]next");console.log(value); },
      error:(error: any) => { console.log(error); },
      complete: () => { console.log("[3]complete"); }
    }
  )
).subscribe();